export default {
  menuList: (state) => {
    console.log(state);
    let menuList = state.rightList.map((v) => {
      let item = {
        label: v.title,
        path: v.route,
      };
      if (Array.isArray(v.sub_menus) && v.sub_menus.length) {
        let children = v.sub_menus.reduce(function (arr, cv) {
          if (cv.navigation === 1) {
            arr.push({
              label: cv.title,
              path: cv.route,
            });
          }
          return arr;
        }, []);
        item.children = children;
      }
      return item;
    });

    if (process.env.NODE_ENV === "development") {
      /*   menuList.push({
        label: "权限/菜单",
        path: "system1",
        children: [
          {
            label: "权限",
            path: "/system/permissions",
          },
          {
            label: "菜单",
            path: "/system/menu",
          },
        ],
      }); */
    }
    return menuList;
  },
};
